from parse.symbol_table.variable import Variable
from lexer.token.token_type import TokenType

class Array(Variable):
    def __init__(self,
                 scopePath: list,
                 isExterned: bool,
                 token_type: TokenType,
                 name: str,
                 length: int):
        super(Array, self).__init__(scopePath, isExterned, token_type, name)

        self.length = length
        if length <= 0:
            raise Exception("数组长度不能小于等于0")
        else:
            self.isLeft = False
            self.size *= length # 变量大小乘以数组长度
